;; statement language

(module tests mzscheme
  
  (provide test-list)
  ;;;;;;;;;;;;;;;; tests ;;;;;;;;;;;;;;;;
  
;; Test cases have the following form:
;; (test-name program trace) 
;; where 
;;  test-name := symbol
;;  program::= string
;;  trace ::= ERROR |  (list-of (or bool number))

  (define test-list
    '( 
       (just-print "print 4"(4)) 
       (print-exp "print -(3,5)" (-2))
       (multiple-print "{print -(3,5);print 6}" (-2 6))
       (if-statement "if zero?(0) print -(3,5) print 6" (-2))
       (assign-test "{x = 4 ; print x}" (4))
       
      
      (test1 "var x,y; {x = 3; y = 4; print -(y,x)}"
        (1))

      (test3 " var x; {x = 3; print x;              
                 var x; {x = 4; print x};  
                 print x}"
        (3 4 3))
      (block-stmt1 "var i,j; { i = 3 ; j = 4 ; print -(i,j); print -(j,i)}"
        (-1 1))

      (block-test-2 "var i,j; { i = 3 ; j = 4 ; print -(p,j); print -(j,i)}" 
        error)
      
      (test4 "var f,x; {f = proc(x,y) -(x,y);       
                  x = 3;
                  print (f 4 x)}"
        (1))
      (block-stmt1 "var i,j; { i = 3 ; j = 4 ; print -(i,j); print -(j,i)}"
        (-1 1))

      (block-test-2 "var i,j; { i = 3 ; j = 4 ; print -(p,j); print -(j,i)}" 
        error)
      
      (test2 "var x,y,z; {x = 3; y = 4; z = 0;           
                    while not(zero?(x)) 
                      {z = -(z,-(0,y)); x = -(x,1)};
                    print z}"
        (12))

      ))
  )